﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit_lesson_form.aspx.cs" Inherits="SQT.tracnghiem.Ajax.ASP.Lesson.edit_lesson_form" %>

<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <div id="edit_lesson_id" class="w3-hide"><%=this.lesson %></div>
    <div class="w3-padding w3-row">
        <label class="w3-col l3">Tên bài</label><input class="w3-threequarter w3-text-black" type="text" required="required" id="txt_edit_lesson" placeholder="Nhập tên bài giảng" value="<%=this.name %>" autofocus="autofocus" />
    </div>
    <%var get_lesson = new TblLessonController().FetchAll().Where(x => x.LessonId == lesson).Single();
      var get_role = new TblUserRoleController().FetchAll(); %>
    <div class="w3-padding w3-row">
        <label class="w3-col l3">Cấp quyền</label>
        <div class="checkbox w3-threequarter">
            <%
                if (get_lesson.LessonRole != "")
                {
            %>
            <%
              foreach (TblUserRole role in get_role)
              {
                  if (checkNumberFromArray(get_lesson.LessonRole, role.RoleId))
                  {
            %>
            <input type="checkbox" checked="checked" value="<%=role.RoleId %>" id="edit_quyen<%=role.RoleId %>" class="edit_quyen" /><label for="edit_quyen<%=role.RoleId %>"><%=role.RoleName %></label>&nbsp;&nbsp;&nbsp;&nbsp;
            <%
                                  }
                                  else
                                  {
            %>
            <input type="checkbox" value="<%=role.RoleId %>" id="edit_quyen<%=role.RoleId %>" class="edit_quyen" /><label for="edit_quyen<%=role.RoleId %>"><%=role.RoleName %></label>&nbsp;&nbsp;&nbsp;&nbsp;
            <%}
                          } %>
            <%}else{ 
                    foreach (TblUserRole role in get_role)
              {%>

            <input type="checkbox" value="<%=role.RoleId %>" id="edit_quyen<%=role.RoleId %>" class="edit_quyen" /><label for="edit_quyen<%=role.RoleId %>"><%=role.RoleName %></label>&nbsp;&nbsp;&nbsp;&nbsp;
            <%}}%>
        </div>
    </div>
    <div class="w3-row w3-padding">
        <label class="w3-quarter w3-padding-top">Đóng/Mở bài</label>
        <div class="edit_active w3-half w3-xlarge">
            <%if (get_lesson.LessonTurn == false)
              { %>
            <i class="on fa fa-toggle-on fa-rotate-180 w3-text-red w3-animate-opacity off"></i>
            <%}
              else
              { %>
            <i class="on fa fa-toggle-on w3-animate-opacity w3-text-white"></i>
            <%} %>
        </div>
    </div>
</body>
</html>
